<template>
	<div>
		<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="itme in newsList" :key="itme.id">
					<router-link :to="'/home/newsInfo/' + itme.id">
						<img class="mui-media-object mui-pull-left" :src="itme.img_url">
						<div class="mui-media-body">
							<h1>{{ itme.title }}</h1>
							<p class='mui-ellipsis'>
								<span>发表时间:{{ itme.add_time | dataFormat }}</span><span>点击:{{ itme.click }}</span>
							</p>
						</div>
					</router-link>
				</li>
			</ul>
	</div>
</template>

<script>
	export default {
		data(){
			return {
				newsList: []
			}
		},
		methods: {
			getNewList(){
				this.$http.get('api/getnewslist').then(res=>{
					this.newsList = res.body.message;
				})
			}
		},
		created(){
			this.getNewList();
		}
	}
</script>

<style>
	.mui-table-view-cell.mui-media h1{
		font-size: 14px;
	}
	/* 第一种实现方式 逼格高，推荐 */
	.mui-table-view-cell.mui-media p{
		font-size: 12px;
		display: flex;
		justify-content: space-between;
	}
	/* 第二种 */
	/* .mui-table-view-cell.mui-media p span:nth-child(2){
		float: right;
		text-align: center;
	} */
</style>
